function expand(s,id,id1){
    var td = s;
    td.className = "menuHoverH";
    id.className = "menuHover";
    id1.className = "menuNormalH";
}
function collapse(s,id,id1){
    var td = s;
    td.className = "menuNormalH";
    id.className = "menuNormal";
    id1.className = "menuHoverH";
}

function showPopup(strURL, w, h)
{
			var left, top, setting;
			var	popupWin;
		left=(screen.width - w)/2;
		top=(screen.height - h)/2;
				
		setting = "width=" + w + ",height=" + h + ", scrollbars=no, toolbar=no, titlebar=no," 
				+ "dependent=yes, menubar=no, location=no, status=no, directories=0, "		
				+ "top=" + top + ", left=" + left + "'";
			
		popupWin = open(strURL,"",setting);
}

// BANNER OBJECT
function Banner(objName)
   {
	this.obj = objName;
	this.aNodes = [];
	this.currentBanner =Math.floor(Math.random()*3);
	};

// ADD NEW BANNER
Banner.prototype.add = function(bannerType, bannerPath, bannerDuration, height, width) {
	this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerType, bannerPath, bannerDuration, height, width);
};

// Node object
function Node(name, bannerType, bannerPath, bannerDuration, height, width) {
	this.name = name;
	this.bannerType = bannerType;
	this.bannerPath = bannerPath;
	this.bannerDuration = bannerDuration;
	this.height = height
	this.width = width;
//	alert (name +"|" + bannerType +"|" + bannerPath +"|" + bannerDuration +"|" + height +"|" + width + "|" + hyperlink);
};
// Outputs the banner to the page
Banner.prototype.toString = function() {
	var str = ""
	
	//alert(this.aNodes.length);
	for (var iCtr=0; iCtr < this.aNodes.length; iCtr++) //old: iCtr=0
	    { 
	    //alert(pos);
		str = str + '<span name="'+this.aNodes[iCtr].name+'" '
		str = str + 'id="'+this.aNodes[iCtr].name+'" ';
		str = str + 'class="m_banner_hide" ';
		str = str + 'bgcolor="#FFFCDA" ';	// CHANGE BANNER COLOR HERE
		str = str + 'align="center" ';
		str = str + 'valign="top" >\n';
		if ( this.aNodes[iCtr].bannerType == "TEXT" )
		{
			str=str+ '<iframe width="'+this.aNodes[iCtr].width+'" height="'+this.aNodes[iCtr].height+'" src="'+this.aNodes[iCtr].bannerPath+'" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe> ';
		}	
		if ( this.aNodes[iCtr].bannerType == "FLASH" ){
			str=str+ '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '
			str=str+ 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" '
			str=str+ 'width="'+this.aNodes[iCtr].width+'" '
			str=str+ 'height="'+this.aNodes[iCtr].height+'" '
			str=str+ 'id="bnr_'+this.aNodes[iCtr].name+'" align="middle" VIEWASTEXT> '
			str=str+ '<param name="allowScriptAccess" value="always" />'
			str=str+ '<param name="movie" value="'+this.aNodes[iCtr].bannerPath+'" />'
			//str=str+ 'param name="FlashVars" value="'+vars+'" />'
			str=str+ '<param name="wmode" value="transparent" />'
			str=str+ '<param name="menu" value="false" />'
			str=str+ '<param name="quality" value="high" />'
			str=str+ '<embed src="'+this.aNodes[iCtr].bannerPath+'" wmode="transparent" menu="false" quality="high" width="'+this.aNodes[iCtr].width+'" height="'+this.aNodes[iCtr].height+'" name="bnr_'+this.aNodes[iCtr].name+'" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
			str=str+ '</embed></object>'
			
		}else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){
			str = str + '<img src="'+this.aNodes[iCtr].bannerPath+'" ';
			str = str + 'border="0" ';
			str = str + 'height="'+this.aNodes[iCtr].height+'" ';
			str = str + 'width="'+this.aNodes[iCtr].width+'">';
		}

		if (this.aNodes[iCtr].hyperlink != ""){
			str = str + '</a>';
		}

		str += '</span>';
			}
	document.write(str);
str="";
return str;
};

// START THE BANNER ROTATION
Banner.prototype.start = function(){
	this.changeBanner();
	var thisBannerObj = this.obj;
}

// CHANGE BANNER
Banner.prototype.changeBanner = function(){
	var thisBanner;
	var prevBanner = -1;
	if (this.currentBanner>this.aNodes.length-1)
	{
		this.currentBanner=0;
	}
	if (this.currentBanner < this.aNodes.length ){
		thisBanner = this.currentBanner;
		if (this.aNodes.length > 1){
			if ( thisBanner > 0 ){
				prevBanner = thisBanner - 1;
			}else{
				prevBanner = this.aNodes.length-1;
			}
		}
		if (this.currentBanner < this.aNodes.length - 1){
			this.currentBanner = this.currentBanner + 1;
		}else{
			this.currentBanner = 0;
		}
	}
	

	if (prevBanner >= 0){
		document.getElementById(this.aNodes[prevBanner].name).className = "m_banner_hide";
	}
	document.getElementById(this.aNodes[thisBanner].name).className = "m_banner_show";
}
//banner = new Banner('banner');
//banner.add('FLASH','flash/banner.swf',15,130,779);
function flash(id,h,w){
    banner = new Banner(id);
    banner.add('FLASH',id,15,h,w);
    document.write(banner);banner.start();
}

